<?xml version="1.0" encoding="UTF-8"?>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core"
      xml:lang="en" lang="en"
      xmlns:t="http://myfaces.apache.org/tomahawk">
<body>
<h:form id="uploadForm" enctype="multipart/form-data">
<h:panelGroup rendered="#{uploaderbean.uploaded==false}">
    <t:inputFileUpload id="fileUpload" value="#{uploaderbean.uploadedFile}" required="true"/>
    <h:commandButton value="#{uploadloc.toload}" action="#{uploaderbean.uploadFile}">
    </h:commandButton>
</h:panelGroup>
    </h:form>
<h:form>
    <h:panelGrid columns="1">
    <h:panelGroup rendered="#{uploaderbean.uploaded==true}">
    <h:graphicImage value="/image?imagetmp=#{uploaderbean.smallImageName}" />
    </h:panelGroup>
        <h:outputText value="#{uploadloc.name}"/>
      <h:inputText value="#{uploaderbean.localElementName}" id="uploadname" required="true" requiredMessage="#{validationmessages.namealert}"/>
    <h:outputText value="#{uploadloc.category}" />
    <h:inputText value="#{uploaderbean.localCategoryName}" id="uploadCat" required="true" requiredMessage="#{validationmessages.categoryalert}"/>
    <h:outputText value="#{uploadloc.content}"/>
    <h:inputText value="#{uploaderbean.localTextContent}" id="uploadCon" required="true" requiredMessage="#{validationmessages.contentalert}"/>
    <h:outputText value="#{uploadloc.price}"/>
    <h:inputText id="price" value="#{uploaderbean.localPrice}" required="true" requiredMessage="#{validationmessages.variablealert}" validator="uplodoadedfilevalidator">
    </h:inputText>
    <h:panelGroup>
        <h:commandButton value="#{uploadloc.save}" action="#{uploaderbean.saveElementInBD}"/>
        <h:commandButton value="#{uploadloc.clear}" action="#{uploaderbean.eraseAll}" immediate="true"/>
        <h:commandButton value="#{uploadloc.back}" action="#{uploaderbean.backToMain}" immediate="true"/>
    </h:panelGroup>
</h:panelGrid>
    <h:panelGrid columns="1">
    <h:message for="price" showSummary="false" showDetail="true" errorStyle="color:#ff0000"/>
    <h:message for="uploadCat" showSummary="false" showDetail="true" errorStyle="color:#ff0000"/>
    <h:message for="uploadCon" showSummary="false" showDetail="true" errorStyle="color:#ff0000"/>
    <h:message for="uploadname" showSummary="false" showDetail="true" errorStyle="color:#ff0000"/>
    </h:panelGrid>
</h:form>
</body>
</html>